package com.tjetc.Impl;

import com.tjetc.domain.Disease;
import com.tjetc.mapper.DiseaseMapper;
import com.tjetc.service.DiseaseService;
import com.tjetc.utils.Db;

import java.util.List;

public class DiseaseServiceImpl implements DiseaseService {
    DiseaseMapper diseaseMapper= Db.getMapper(DiseaseMapper.class);
    @Override
    public void addDisease(Disease disease) {
        diseaseMapper.insertSelective(disease);

    }

    @Override
    public void updateDisease(Disease disease) {
        diseaseMapper.updateByPrimaryKeySelective(disease);
    }

    @Override
    public Disease findDisease(int id) {
        Disease disease = diseaseMapper.selectByPrimaryKey(id);
        return disease;
    }

    @Override
    public void deleteDisease(int id) {
        diseaseMapper.deleteByPrimaryKey(id);
    }


    @Override
    public int findNumberOfDisease(int id) {
        int number = diseaseMapper.findNumberOfDisease(id);
        return number;
    }

    @Override
    public Disease findDid(int diseaseId) {
        return diseaseMapper.selectByPrimaryKey(diseaseId);
    }
    @Override
    public List<Disease> findAll() {
        return diseaseMapper.findAll();
    }
}
